<?php
/**
 * Created by PhpStorm.
 * User: liuzh
 * Date: 2018/7/3
 * Time: 17:46
 */

namespace App\Observers;
use App\Models\Category;
use Cache;

class CategoryObserver
{
    // 在保持时清空 cache_key 对应的缓存
    public function saved(Category $category)
    {
        Cache::forget($category->cache_key);
    }


    public function deleted(Category $category)
    {
        Cache::forget($category->cache_key);
    }
}